package com.example.demo.controller;

import com.example.demo.pojo.Sc;
import com.example.demo.service.ScService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/sc")
public class ScController {
    @Autowired
    private ScService scService;

    // 根据选课号查询学生 ID 列表
    @RequestMapping("/selectStudent")
    public List<Integer> selectStudentIdByCourseId(String courseId) {
        return scService.selectStudentIdByCourseId(courseId);
    }

    // 根据学生 ID 查询选课信息，包含课程信息
    @RequestMapping("/selectCourse")
    public List<Sc> selectCourseByStudentId(Integer studentId) {

        return scService.selectCourseByStudentId(studentId);
    }
}